package org.nepu.scr.indexrate.converter.riskrate.operationwellrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.operationwellrisk.OperationWellRiskMenu;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class OperationWellRiskMenuConverter implements AttributeConverter<OperationWellRiskMenu, String> {
    @Override
    public String convertToDatabaseColumn(OperationWellRiskMenu operationWellRiskMenu) {
        return JSONUtil.toJsonStr(operationWellRiskMenu);
    }

    @Override
    public OperationWellRiskMenu convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, OperationWellRiskMenu.class);
    }
}
